package com.lkx.sms.data;

import java.util.ArrayList;
import java.util.List;


public class SmsSession implements Comparable<SmsSession>{

	private int thread_id;
	private String address;
	private String person;
	//the date of last sms recevied in this session
	private long lastUpdate;
	private List<SmsContent> smsContents = new ArrayList<SmsContent>();
	
	public SmsSession() {
	}
	
	public SmsSession(int thread_id, String address) {
		super();
		this.thread_id = thread_id;
		this.address = address;
	}

	public int getThread_id() {
		return thread_id;
	}
	public void setThread_id(int thread_id) {
		this.thread_id = thread_id;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getPerson() {
		return person;
	}
	public void setPerson(String person) {
		this.person = person;
	}
	public List<SmsContent> getSmsContents() {
		return smsContents;
	}
	public void setSmsContents(List<SmsContent> smsContents) {
		this.smsContents = smsContents;
	}
	public void addSmsContent(SmsContent smsContent) {
		smsContents.add(smsContent);
	}

	public long getLastUpdate() {
		return lastUpdate;
	}

	public void setLastUpdate(long lastUpdate) {
		if(lastUpdate>this.lastUpdate) {
			this.lastUpdate = lastUpdate;
		}
	}

	@Override
	public int compareTo(SmsSession another) {
		if(this.getLastUpdate()>another.getLastUpdate()) {
			return -1;
		}else if(this.getLastUpdate()<another.getLastUpdate()) {
			return 1;
		}
		return 0;
	}
	
}
